package config

import (
	"192.168.1.75/go-pkg/gormx"
	"192.168.1.75/go-pkg/logx"
	"192.168.1.75/go-pkg/redisx"
)

var Config ConfigType

type ConfigType struct {
	ProjectName string `mapstructure:"project_name"`
	// 对外http接口端口
	HTTPPort string `mapstructure:"http_port"`
	// grpc端口
	GRPCPort string `mapstructure:"grpc_port"`
	// 跨域
	Cors struct {
		AllowOrigins []string `mapstructure:"allow_origins"`
		AllowMethods []string `mapstructure:"allow_methods"`
		AllowHeaders []string `mapstructure:"allow_headers"`
	} `mapstructure:"cors"`
	// mysql配置
	Mysql gormx.Config `mapstructure:"mysql"`
	// 自动数据迁移检查
	AutoMigrate bool `mapstructure:"auto_migrate"`
	// 禁止重启检查
	DisableRestartCheck bool `mapstructure:"disable_restart_check"`
	// redis配置
	Redis redisx.Config `mapstructure:"redis"`
	// 邮箱配置
	Email struct {
		Host     string `mapstructure:"host"`
		Port     int    `mapstructure:"port"`
		Username string `mapstructure:"username"`
		Password string `mapstructure:"password"`
	} `mapstructure:"email"`
	// 公众号
	Wechat struct {
		AppID     string `mapstructure:"app_id"`
		AppSecret string `mapstructure:"app_secret"`
	} `mapstructure:"wechat"`
	// 管理员账号
	AdminUser struct {
		Username string `mapstructure:"username"`
		Password string `mapstructure:"password"`
	} `mapstructure:"admin-user"`
	// 日志配置
	Log logx.Config `mapstructure:"log"`
	// 微服务配置,serviceName-[]serviceConf【ip:http_port:grpc_port】
	Services map[string][]string `mapstructure:"services"`
	// 文件保存路径
	FileSaveDir string `mapstructure:"file_save_dir"`
	// 主机域名
	Host string `mapstructure:"host"`
	// 本地服务,serviceName-serviceConf【ip:http_port:grpc_port】
	LocalServices map[string]string `mapstructure:"local_services"`
}
